{extend name="base"/}
{block name="resources"}
<link rel="stylesheet" href="__STATIC__/ext/video/video.css">
<link rel="stylesheet" type="text/css" href="__STATIC__/ext/searchable_select/searchable_select.css" />
<link rel="stylesheet" type="text/css" href="SHOP_CSS/goods_edit.css" />
<style>
    .invoice-content-box{
        display: flex;
        flex-wrap: wrap;
    }
    .invoice-content-block .layui-form-select{margin-bottom:10px}
    .invoice-content-block .layui-form-select:last-child{margin-bottom:0}
    .invoice-content-block .item{
        position:relative;
        margin-bottom:10px;
        margin-right: 10px;
    }
    .invoice-content-block .item .layui-icon-close{font-size:12px;position:absolute;top:-8px;right:-8px;width:16px;height:16px;line-height:16px;text-align:center;color:#fff;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;background:rgba(0,0,0,.3);cursor:pointer}
    .invoice-tip{color:#ff8143;padding-left:90px;}
</style>
{/block}
{block name="main"}
<div class="layui-form">
    <div class="ns-tab layui-tab layui-tab-brief" lay-filter="goods_tab">
        <!--<ul class="layui-tab-title">
            <li class="layu1i-this" lay-id="basic">基础设置</li>
            <li lay-id="detail">商品详情</li>
            <li lay-id="attr">商品参数</li>
        </ul>-->

        <div class="layui-tab-content">

            <!-- 基础设置 -->
            <div class="layui-tab-item layui-show">

                <div class="layui-card ns-card-common">
                  <!--  <div class="layui-card-header">
                        <span class="ns-card-title">基础信息</span>
                    </div>-->

                    <div class="layui-card-body">
                        <input type="hidden" name="site_id" value="{$goods_info['site_id']}">

                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="required">*</span>商品名称：</label>
                            <div class="layui-input-inline">
                                <input name="goods_name" type="text" value="{$goods_info['goods_name']}" placeholder="请输入商品名称，不能超过100个字符" maxlength="100" autocomplete="off" lay-verify="goods_name" class="layui-input ns-len-long">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="required">*</span>销售价：</label>
                            <div class="layui-input-block">
                                <input type="text" name="price" value="{$goods_info['price']}" placeholder="0.00" lay-verify="price" class="layui-input ns-len-short" autocomplete="off">
                                <div class="layui-form-mid">元</div>
                            </div>
<!--                            <div class="ns-word-aux">商品没有相关优惠活动的实际卖价</div>-->
                        </div>


                        <div class="layui-form-item goods-image-wrap">
                            <label class="layui-form-label"><span class="required">*</span>列表图片：</label>
                            <div class="layui-input-block">
                                <!--商品主图项-->
                                <div class="js-goods-image"></div>
                            </div>
<!--                            <div class="ns-word-aux">第一张图片将作为商品主图,支持同时上传多张图片,多张图片之间可随意调整位置；支持jpg、gif、png格式上传或从图片空间中选择，建议使用尺寸800x800像素以上、大小不超过1M的正方形图片，上传后的图片将会自动保存在图片空间的默认分类中，最多上传10张（至少1张）</div>-->
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">排序：</label>
                            <div class="layui-input-block">
                                <input type="number" name="sort" value="{$goods_info['sort']}" class="layui-input ns-len-short" placeholder="0" autocomplete="off">
                            </div>
                            <div class="ns-word-aux">商品默认排序号为0，数字越大，排序越靠前，数字重复，则最新添加的靠前。</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="required">*</span>状态：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="goods_state" value="1" title="上架" lay-filter="goods_state" {if $goods_info['goods_state'] == 1 }checked{/if}>
                                <input type="radio" name="goods_state" value="0" title="下架" lay-filter="goods_state" {if $goods_info['goods_state'] == 0 }checked{/if}>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">服务说明：</label>
                            <div class="layui-input-inline ns-special-length">
                                <input type="hidden" name="goods_content" value="{$goods_info['goods_content']}" />
                                <script id="editor" type="text/plain" style="width:100%;height:500px;"></script>
                            </div>
                        </div>

                        <script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/ueditor.config.js"></script>
                        <script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/ueditor.all.js"> </script>
                        <script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/lang/zh-cn/zh-cn.js"></script>

                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="required">*</span>分销分佣比例：</label>
                            <div class="layui-input-block">
                                <input type="number" name="fenxiao_commission_rate" value="{$goods_info['fenxiao_commission_rate']}" lay-verify="fenxiao_commission_rate" class="layui-input ns-len-short" autocomplete="off">
                                <div class="layui-form-mid">%</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">限购：</label>
                            <div class="layui-input-block">
                                <input type="number" name="max_buy" placeholder="" lay-verify="max_buy" value="{$goods_info['max_buy']}" class="layui-input ns-len-short" autocomplete="off">
                                <div class="layui-form-mid">件</div>
                            </div>
                            <div class="ns-word-aux">该限购为终身限购，0为不限购</div>
                        </div>

                    </div>
                </div>

                <!-- 价格库存 -->
                <div class="layui-card ns-card-common" hidden>
                    <div class="layui-card-header">
                        <span class="ns-card-title">价格库存</span>
                    </div>

                    <div class="layui-card-body">

                        <div class="layui-form-item">
                            <label class="layui-form-label">启用多规格：</label>
                            <div class="layui-input-inline">
                                <input type="checkbox" value="1" lay-skin="switch" name="spec_type" lay-filter="spec_type" lay-verify="spec_type" {notempty name="$goods_info['goods_spec_format']" }checked{/notempty}>
                                <input type="hidden" id="spec_type_status" {if empty($goods_info['goods_spec_format'])} value="0" {else/} value="1" {/if}>
                            </div>
                        </div>

                        <!-- 单规格 -->
                        <div class="js-single-spec" {notempty name="$goods_info['goods_spec_format']" }style="display:none;"{/notempty}>

                        <!--<div class="layui-form-item">
                            <label class="layui-form-label"><span class="required">*</span>销售价：</label>
                            <div class="layui-input-block">
                                <input type="text" name="price" value="{$goods_info['price']}" placeholder="0.00" lay-verify="price" class="layui-input ns-len-short" autocomplete="off">
                                <div class="layui-form-mid">元</div>
                            </div>
                            <div class="ns-word-aux">商品没有相关优惠活动的实际卖价</div>
                        </div>-->

                        <div class="layui-form-item" hidden>
                            <label class="layui-form-label">划线价：</label>
                            <div class="layui-input-block">
                                <input type="text" name="market_price" value="{$goods_info['market_price']}" placeholder="0.00" lay-verify="market_price" class="layui-input ns-len-short" autocomplete="off">
                                <div class="layui-form-mid">元</div>
                            </div>
                            <div class="ns-word-aux">商品没有优惠活动显示的划线价格，如果商品有折扣等优惠活动划线价显示销售价</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">成本价：</label>
                            <div class="layui-input-block">
                                <input type="text" name="cost_price" value="{$goods_info['cost_price']}" placeholder="0.00" class="layui-input ns-len-short" lay-verify="cost_price" autocomplete="off">
                                <div class="layui-form-mid">元</div>
                            </div>
                            <div class="ns-word-aux">成本价将不会对前台会员展示，用于商家统计使用</div>
                        </div>

                        <div class="layui-form-item" hidden>
                            <label class="layui-form-label">重量：</label>
                            <div class="layui-input-block">
                                <input type="text" name="weight" value="{$goods_info['sku_list'][0]['weight']}" placeholder="0.00" class="layui-input ns-len-short" lay-verify="weight" autocomplete="off">
                                <div class="layui-form-mid">kg</div>
                            </div>
                        </div>

                        <div class="layui-form-item" hidden>
                            <label class="layui-form-label">体积：</label>
                            <div class="layui-input-block">
                                <input type="text" name="volume" value="{$goods_info['sku_list'][0]['volume']}" placeholder="0.00" class="layui-input ns-len-short" lay-verify="volume" autocomplete="off">
                                <div class="layui-form-mid">m3</div>
                            </div>
                        </div>

                        <div class="layui-form-item" >
                            <label class="layui-form-label">商品编码：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sku_no" value="{$goods_info['sku_list'][0]['sku_no']}" placeholder="请输入商品编码" maxlength="50" class="layui-input ns-len-long" autocomplete="off">
                            </div>
                        </div>

                    </div>

                    <!-- 多规格 -->
                    <div class="js-more-spec" {notempty name="$goods_info['goods_spec_format']" }style="display:block;"{/notempty}>

                    <!--规格项/规格值-->
                    <div class="spec-edit-list"></div>

                    <div class="layui-form-item js-add-spec">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <button class="layui-btn ns-bg-color" type="button">添加规格</button>
                        </div>
                    </div>

                    <div class="layui-form-item batch-operation-sku">
                        <label class="layui-form-label">批量操作：</label>
                        <div class="layui-input-inline">
                            <span class="ns-text-color" data-field="spec_name">副标题</span>
                            <span class="ns-text-color" data-field="price" data-verify="price">销售价</span>
                            <!--									<span class="ns-text-color" data-field="market_price" data-verify="market_price">划线价</span>-->
                            <span class="ns-text-color" data-field="cost_price" data-verify="cost_price">成本价</span>
                            <span class="ns-text-color" data-field="stock" data-verify="stock">库存</span>
                            <!--									<span class="ns-text-color" data-field="stock_alarm" data-verify="stock_alarm">库存预警</span>-->
                            <!--									<span class="ns-text-color" data-field="weight" data-verify="weight">重量(kg)</span>-->
                            <!--									<span class="ns-text-color" data-field="volume" data-verify="volume">体积(m³)</span>-->
                            <span class="ns-text-color" data-field="sku_no" data-verify="">商品编码</span>
                            <input type="text" class="layui-input ns-len-short" name="batch_operation_sku" autocomplete="off" />
                            <button class="layui-btn ns-bg-color confirm" type="button">确定</button>
                            <button class="layui-btn layui-btn-primary cancel" type="button">取消</button>
                        </div>
                    </div>

                    <!--编辑时用到的SKU列表-->
                    <div class="js-edit-sku-list">
                        {foreach name="$goods_info['sku_list']" item="vo" key="k"}
                        <div data-index="{$k}">
                            <input type="hidden" name="edit_sku_id" value="{$vo['sku_id']}" />
                            <input type="hidden" name="edit_spec_name" value="{$vo['spec_name']}" />
                            <input type="hidden" name="edit_sku_no" value="{$vo['sku_no']}" />
                            <input type="hidden" name="edit_sku_spec_format" value="{$vo['sku_spec_format']}" />
                            <input type="hidden" name="edit_price" value="{$vo['price']}" />
                            <input type="hidden" name="edit_market_price" value="{$vo['market_price']}" />
                            <input type="hidden" name="edit_cost_price" value="{$vo['cost_price']}" />
                            <input type="hidden" name="edit_stock" value="{$vo['stock']}" />
                            <input type="hidden" name="edit_stock_alarm" value="{$vo['stock_alarm']}" />
                            <input type="hidden" name="edit_weight" value="{$vo['weight']}" />
                            <input type="hidden" name="edit_volume" value="{$vo['volume']}" />
                            <input type="hidden" name="edit_sku_image" value="{$vo['sku_image']}" />
                            <input type="hidden" name="edit_sku_images" value="{$vo['sku_images']}" />
                            <input type="hidden" name="edit_is_default" value="{$vo['is_default']}" />
                        </div>
                        {/foreach}
                    </div>

                    <!--sku列表-->
                    <div class="layui-form-item sku-table">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-block"></div>
                    </div>

                </div>

                <div class="layui-form-item js-goods-stock-wrap" {notempty name="$goods_info['goods_spec_format']" }style="display:none;"{/notempty}>
                <label class="layui-form-label"><span class="required">*</span>库存：</label>
                <div class="layui-input-block">
                    <input type="number" name="goods_stock" value="{$goods_info['goods_stock']}" placeholder="0" lay-verify="goods_stock" class="layui-input ns-len-short" autocomplete="off" {notempty name="$goods_info['goods_spec_format']" }disabled{/notempty}>
                    <div class="layui-form-mid">件</div>
                </div>
            </div>

            <div class="layui-form-item js-goods-stock-wrap" {notempty name="$goods_info['goods_spec_format']" }style="display:none;"{/notempty} hidden>
            <label class="layui-form-label">库存预警：</label>
            <div class="layui-input-block">
                <input type="number" name="goods_stock_alarm" value="{$goods_info['goods_stock_alarm']}" placeholder="0" lay-verify="goods_stock_alarm" class="layui-input ns-len-short" autocomplete="off">
                <div class="layui-form-mid">件</div>
            </div>
            <div class="ns-word-aux">商品库存少于预警数量，商品列表库存数量标红显示，0为不预警。</div>
        </div>



    </div>
</div>




<!-- 其他信息 -->
<div class="layui-card ns-card-common" hidden>
    <div class="layui-card-header">
        <span class="ns-card-title">其他信息</span>
    </div>

    <div class="layui-card-body">

       <!-- <div class="layui-form-item">
            <label class="layui-form-label">限购：</label>
            <div class="layui-input-block">
                <input type="number" name="max_buy" placeholder="" lay-verify="max_buy" value="{$goods_info['max_buy']}" class="layui-input ns-len-short" autocomplete="off">
                <div class="layui-form-mid">件</div>
            </div>
            <div class="ns-word-aux">该限购为终身限购，0为不限购</div>
        </div>-->

        <div class="layui-form-item">
            <label class="layui-form-label">起售：</label>
            <div class="layui-input-block">
                <input type="number" name="min_buy" placeholder="" lay-verify="min_buy" value="{$goods_info['min_buy']}" class="layui-input ns-len-short" autocomplete="off">
                <div class="layui-form-mid">件</div>
            </div>
            <div class="ns-word-aux">起售数量超出商品库存时，买家无法购买该商品</div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">单位：</label>
            <div class="layui-input-block">
                <input type="text" name="unit" value="{$goods_info['unit']}" placeholder="请输入单位" autocomplete="off" class="layui-input ns-len-short">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">定时下架：</label>
            <div class="layui-input-block">
                <input type="radio" name="timer_off_status" value="1" title="启用" lay-filter="timer_off" {if $goods_info['timer_off'] > 0} checked {/if}>
                <input type="radio" name="timer_off_status" value="2" title="不启用" lay-filter="timer_off" {if $goods_info['timer_off'] == 0} checked {/if}>
            </div>
            <div class="ns-word-aux">启用定时下架后，到达设定时间，此商品将自动下架。</div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否参与会员等级折扣：</label>
            <div class="layui-input-block">
                <div class="layui-input-inline">
                    <input type="radio" name="is_consume_discount" value="0" title="不参与" {if $goods_info['is_consume_discount'] == 0} checked {/if}>
                    <input type="radio" name="is_consume_discount" value="1" title="参与" {if $goods_info['is_consume_discount'] > 0} checked {/if}>
                </div>
            </div>
            <div class="ns-word-aux">如果该商品未单独配置过优惠规则，则按照默认会员等级折扣优惠</div>
        </div>
    </div>
</div>
</div>

<!-- 商品详情 -->



</div>
</div>

<input type="hidden" name="goods_id" value="{$goods_info['goods_id']}" />
<input type="hidden" name="goods_spec_format" value="{$goods_info['goods_spec_format']}" />
<input type="hidden" name="goods_image" value="{$goods_info['goods_image']}" />
<input type="hidden" name="goods_attr_format" value="{$goods_info['goods_attr_format']}" />

<div class="fixed-btn">
    <button class="layui-btn layui-btn-primary ns-border-color ns-text-color js-prev" lay-submit="" lay-filter="prev">上一步</button>
    <button class="layui-btn ns-bg-color js-save" lay-submit="" lay-filter="save">保存</button>
    <!--		<button class="layui-btn layui-btn-primary ns-border-color ns-text-color js-next" lay-submit="" lay-filter="next">下一步</button>-->
</div>
</div>



<!--规格项模板-->
<script type="text/html" id="specTemplate">

    {{# for(var i=0;i<d.list.length;i++){ }}
    <div class="spec-item" data-index="{{i}}">
        <div class="layui-form-item spec">
            <label class="layui-form-label">规格项{{i+1}}：</label>
            <div class="layui-input-inline">
                <select name="spec_item">
                    <option value="0"></option>
                    {{# if(d.list[i].spec_name != ''){ }}
                    <option value="{{d.list[i].spec_id}}" data-attr-name="{{d.list[i].spec_name}}" selected>{{d.list[i].spec_name}}</option>
                    {{# }else{ }}
                    {{# } }}
                </select>
                <i class="layui-icon layui-icon-close" data-index="{{i}}"></i>
            </div>

            {{# if(i==0){ }}
            <div class="layui-input-inline">
                {{# if(d.add_spec_img){ }}
                <input type="checkbox" name="add_spec_img" title="添加规格图片" lay-skin="primary" lay-filter="add_spec_img" checked>
                {{# }else{ }}
                <input type="checkbox" name="add_spec_img" title="添加规格图片" lay-skin="primary" lay-filter="add_spec_img">
                {{# } }}
            </div>
            {{# } }}
        </div>

        {{# if(d.list[i].spec_name != ''){ }}
        <div class="layui-form-item spec-value">
            {{# }else{ }}
            <div class="layui-form-item spec-value" style="display:none;">
                {{# } }}
                <label class="layui-form-label"></label>
                <div class="layui-input-block spec-value">
                    {{# if(d.list[i].value.length){ }}
                    <ul>
                        {{# for(var j=0;j<d.list[i].value.length;j++){ }}
                        <li data-index="{{j}}" data-parent-index="{{i}}" >
                            {{# if(i==0 && d.add_spec_img){ }}
                            <div class="img-wrap">
                                {{# if(d.list[i].value[j].image){ }}
                                <img src="{{ns.img(d.list[i].value[j].image)}}" alt="">
                                {{# }else{ }}
                                <img src="SHOP_IMG/goods_spec_value_empty.png" alt="">
                                {{# } }}
                            </div>
                            {{# } }}
                            <span>{{d.list[i].value[j].spec_value_name}}</span>
                            <!--{{1# if(d.list[i].value[j].is_delete === undefined){ }}-->
                            <i class="layui-icon layui-icon-close" data-parent-index="{{i}}" data-index="{{j}}"></i>
                            <!--{{1# } }}-->
                        </li>
                        {{# } }}
                    </ul>
                    {{# } }}

                    <a class="ns-text-color" href="javascript:;" data-index="{{i}}">+添加规格值</a>

                    <div class="add-spec-value-popup" data-index="{{i}}">
                        <select name="spec_value_item"></select>
                        <button class="layui-btn layui-btn-primary ns-border-color ns-text-color js-cancel-spec-value">取消</button>
                    </div>

                </div>
            </div>

        </div>
        {{# } }}
</script>

<!--SKU列表模板-->
<script type="text/html" id="skuTableTemplate">

    {{# if(d.skuList.length){ }}
    <table class="layui-table">
        <colgroup></colgroup>
        <thead>
        <tr>
            {{# if(d.showSpecName){ }}
            <th colspan="{{d.colSpan}}" style="min-width: 60px;">商品规格</th>
            {{# } }}
            <th rowspan="{{d.rowSpan}}">SKU图片</th>
            <th rowspan="{{d.rowSpan}}">副标题</th>
            <th rowspan="{{d.rowSpan}}"><span class="required">*</span>销售价</th>
            <!--			<th rowspan="{{d.rowSpan}}">划线价</th>-->
            <th rowspan="{{d.rowSpan}}">成本价</th>
            <th rowspan="{{d.rowSpan}}"><span class="required">*</span>库存</th>
            <!--			<th rowspan="{{d.rowSpan}}">库存预警</th>-->
            <!--			<th rowspan="{{d.rowSpan}}">重量(kg)</th>-->
            <!--			<th rowspan="{{d.rowSpan}}">体积(m³)</th>-->
            <th rowspan="{{d.rowSpan}}">SKU编码</th>
            <th rowspan="{{d.rowSpan}}" style="white-space: nowrap;">默认展示</th>
        </tr>
        {{# if(d.colSpan>1){ }}
        <tr>
            {{# for(var i=0;i<d.specList.length;i++){ }}
            <th>{{d.specList[i].spec_name}}</th>
            {{# } }}
        </tr>
        {{# } }}
        </thead>
        <tbody>
        {{# for(var i=0;i<d.skuList.length;i++){ }}
        <tr>
            <td id="sku_img_{{i}}">
                {{# for(var j=0;j<d.skuList[i].sku_images_arr.length;j++){ }}
                <div class="img-wrap" data-index="{{j}}" data-parent-index="{{i}}">
                    <a href="javascript:void(0)">
                        <img src="{{ns.img(d.skuList[i].sku_images_arr[j],'small')}}" layer-src="{{ns.img(d.skuList[i].sku_images_arr[j],'big')}}" />
                    </a>
                    <div class="operation">
                        <i title="图片预览" class="iconfont iconreview js-preview"></i>
                        <i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
                    </div>
                </div>
                {{# } }}
                {{# if(d.skuList[i].sku_images_arr.length<d.goods_sku_max){ }}
                <div class="upload-sku-img" data-index="{{i}}"><i class="layui-icon layui-icon-add-1"></i></div>
                {{# } }}
            </td>
            <td>
                <input type="text" name="spec_name" placeholder="副标题" maxlength="100" value="{{d.skuList[i].spec_name}}" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td>
                <input type="text" name="price" placeholder="销售价" lay-verify="sku_price" value="{{d.skuList[i].price}}" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td hidden>
                <input type="text" name="market_price" placeholder="划线价" value="{{d.skuList[i].market_price}}" lay-verify="sku_market_price" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td>
                <input type="text" name="cost_price" placeholder="成本价" value="{{d.skuList[i].cost_price}}" lay-verify="sku_cost_price" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td>
                <input type="text" name="stock" placeholder="库存" value="{{d.skuList[i].stock}}" lay-verify="sku_stock" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td hidden>
                <input type="text" name="stock_alarm" placeholder="库存预警" value="{{d.skuList[i].stock_alarm}}" lay-verify="sku_stock_alarm" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td hidden>
                <input type="text" name="weight" placeholder="重量(kg)" value="{{d.skuList[i].weight}}" lay-verify="sku_weight" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td hidden>
                <input type="text" name="volume" placeholder="体积(m³)" value="{{d.skuList[i].volume}}" lay-verify="sku_volume" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td>
                <input type="text" name="sku_no" placeholder="SKU编码" value="{{d.skuList[i].sku_no}}" maxlength="50" class="layui-input ns-len-small" autocomplete="off" data-index="{{i}}">
            </td>
            <td style="min-width: 40px;">
                <div class="is-default" data-index="{{i}}" lay-filter="is_default_{{i}}">
                    {{# if(d.skuList[i].is_default == 1) { }}
                    <input type="checkbox" data-index="{{i}}" name="is_default" lay-filter="is_default_{{i}}" lay-skin="switch" checked>
                    {{# }else { }}
                    <input type="checkbox" data-index="{{i}}" name="is_default" lay-filter="is_default_{{i}}" lay-skin="switch">
                    {{# } }}
                </div>
            </td>
        </tr>
        {{# } }}

        </tbody>
    </table>
    {{# } }}
    <div class="ns-word-aux ns-text-color" style="margin: 10px 0 0 0;">默认展示，是多规格商品在客户访问商品时，默认显示的商品规格</div>
</script>

<!--商品主图列表-->
<script type="text/html" id="goodsImage">
    {{# if(d.list.length){ }}
    {{# for(var i=0;i<d.list.length;i++){ }}
    <div class="item upload_img_square_item" data-index="{{i}}">
        <div class="img-wrap">
            <img src="{{ns.img(d.list[i])}}" layer-src>
        </div>
        <div class="operation">
            <i title="图片预览" class="iconfont iconreview js-preview"></i>
            <i title="删除图片" class="layui-icon layui-icon-delete js-delete" data-index="{{i}}"></i>
            <div class="replace_img" data-index="{{i}}">点击替换</div>
        </div>
    </div>
    {{# } }}
    {{# if(d.list.length < d.max){ }}
    <div class="item js-add-goods-image">+</div>
    {{# } }}
    {{# }else{ }}
    <div class="item js-add-goods-image">+</div>
    {{# } }}
</script>

<!--属性列表模板-->
<script type="text/html" id="attrTemplate">
    {{# for(var i=0;i<d.list.length;i++){ }}
    <tr class="goods-attr-tr goods-attr-temp" data-attr-class-id="{{d.list[i].attr_class_id}}" data-attr-class-name="{{d.list[i].attr_class_name}}" data-attr-id="{{d.list[i].attr_id}}" data-attr-name="{{d.list[i].attr_name}}" data-attr-type="{{d.list[i].attr_type}}">
        <td>{{d.list[i].attr_name}}</td>
        <td>
            {{# if(d.list[i].attr_type == 1){ }}
            {{# for(var j=0;j<d.list[i].attr_value_format.length;j++){ }}
            {{# if(d.list[i].attr_value_format[j].checked){ }}
            <input type="radio" name="attr_value_{{d.list[i].attr_id}}" value="{{d.list[i].attr_value_format[j].attr_value_id}}" title="{{d.list[i].attr_value_format[j].attr_value_name}}" data-attr-value-name="{{d.list[i].attr_value_format[j].attr_value_name}}" checked />
            {{# }else{ }}
            <input type="radio" name="attr_value_{{d.list[i].attr_id}}" value="{{d.list[i].attr_value_format[j].attr_value_id}}" title="{{d.list[i].attr_value_format[j].attr_value_name}}" data-attr-value-name="{{d.list[i].attr_value_format[j].attr_value_name}}" />
            {{# } }}
            {{# } }}
            {{# }else if(d.list[i].attr_type == 2){ }}
            {{# for(var j=0;j<d.list[i].attr_value_format.length;j++){ }}
            {{# if(d.list[i].attr_value_format[j].checked){ }}
            <input type="checkbox" name="attr_value_{{d.list[i].attr_id}}" value="{{d.list[i].attr_value_format[j].attr_value_id}}" title="{{d.list[i].attr_value_format[j].attr_value_name}}" data-attr-value-name="{{d.list[i].attr_value_format[j].attr_value_name}}" lay-skin="primary" checked>
            {{# }else{ }}
            <input type="checkbox" name="attr_value_{{d.list[i].attr_id}}" value="{{d.list[i].attr_value_format[j].attr_value_id}}" title="{{d.list[i].attr_value_format[j].attr_value_name}}" data-attr-value-name="{{d.list[i].attr_value_format[j].attr_value_name}}" lay-skin="primary">
            {{# } }}
            {{# } }}
            {{# }else if(d.list[i].attr_type == 3){ }}
            {{# if(d.list[i].attr_value_format != ''){ }}
            <input type="text" name="attr_value_{{d.list[i].attr_id}}" placeholder="{{d.list[i].attr_name}}" value="{{d.list[i].attr_value_format}}" class="layui-input ns-len-mid" autocomplete="off">
            {{# }else{ }}
            <input type="text" name="attr_value_{{d.list[i].attr_id}}" placeholder="{{d.list[i].attr_name}}" class="layui-input ns-len-mid" autocomplete="off">
            {{# } }}
            {{# } }}
        </td>
        <td><input type="number" name="" value="{{d.list[i].sort ? d.list[i].sort : 0}}" placeholder="" class="layui-input attr-sort" autocomplete="off"></td>
        <td><div class="ns-table-btn"><a class="layui-btn" onclick="delAttr(this)">删除</a></div></td>
    </tr>
    {{# } }}
</script>


{/block}
{block name="script"}
<script src="__STATIC__/ext/drag-arrange.js"></script>
<script src="__STATIC__/ext/video/videojs-ie8.min.js"></script>
<script src="__STATIC__/ext/video/video.min.js"></script>
<script src="__STATIC__/ext/searchable_select/searchable_select.js"></script>
<script src="ADMIN_JS/local_goods_edit.js"></script>
<script src="ADMIN_JS/category_select.js"></script>
{/block}

